package java_learn.java_jinjie.object;

import java.util.Objects;

/*
    public boolean equals(Object obj) {
        return (this == obj);
    }
    参数：object obj:可以传递任意对象
    方法体：基本数据类型：比较的是值，引用数据类型：比较的是地址
    this
 */
public class DemoEquals {
    public static void main(String[] args) {
        Person p1 = new Person("大雄", 8);
        Person p = new Person("大雄", 8);
        Person p2 = new Person("静香", 7);
        boolean b = p1.equals(p);
        System.out.println(b);
        String s1 = null;
        boolean b2 = Objects.equals(p1, "sdf");
        System.out.println(b2);
    }
}
